home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / ELECTRON / PCB_DESI / 1540.ZIP / PCBCA110.ZIP / GRAPHICS.C < prev    next >
C/C++ Source or Header  |  1990-11-18  |  1KB  |  50 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. #ifndef VMS
  5. #include <dos.h>
  6. #endif
  7.  
  8. /* graphics support routines */
  9.  
  10. void Dot( int, int, int );
  11. int GetMode( void );
  12. void SetMode( int );
  13.  
  14. void Dot ( color, row, col ) /* draw a dot on the screen */
  15.     int color, row, col;
  16.     {
  17.     union REGS regs;
  18.  
  19. /*printf("Dot(color=%d,row=%d,col=%d)\n",color,row,col);*/
  20. /*return;*/
  21.     regs.h.ah = 0xC; /* write pixel */
  22.     regs.h.al = (char)color;
  23.     regs.x.bx = 0;
  24.     regs.x.cx = col;
  25.     regs.x.dx = row;
  26.     int86( 0x10, ®s, ®s );
  27.     }
  28.  
  29. int GetMode () { /* get the graphics screen mode */
  30.     union REGS regs;
  31.  
  32.     regs.h.ah = 0xF; /* get graphics mode */
  33.     int86( 0x10, ®s, ®s );
  34.     regs.h.ah = 0;
  35. /*printf("GetMode() returns %d\n",regs.x.ax);*/
  36.     return( regs.x.ax );
  37.     }
  38.  
  39. void SetMode ( mode ) /* set the graphics screen mode */
  40.     int mode;
  41.     {
  42.     union REGS regs;
  43.  
  44. /*printf("SetMode(mode=%d)\n",mode);*/
  45. /*return;*/
  46.     regs.h.ah = 0; /* set graphics mode */
  47.     regs.h.al = (char)mode;
  48.     int86( 0x10, ®s, ®s );
  49.     }
  50.